home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
MEMORY
/
OLD
/
MEM208SRC
/
!Memphis
/
s
/
protect
< prev
next >
Wrap
Text File
|
1993-08-12
|
3KB
|
92 lines
; > s.protect
;
; Description ObjAsm source code for snew/sload filters for MemFSFiler
; Author Darren Durbin & Nick Smith
; Version 0.01
; Date 12th August 1993
; Copyright (c) Darren Durbin & Nick Smith, 1993
; *** Assembler directives
GET hdr.regs ; GET register definitions
GET hdr.swis
; Area name C$$code advisable as wanted to link with C output
AREA |C$$code|, CODE, READONLY
EXPORT |protect_code|
; The following bytes contain the name of the following procedure to
; make stack backtracing work, eg. when an address exception occurs!
= "protect_code", 0 ; Align
ALIGN
DCD &ff000010
|protect_code|
CMP r0,#&ff
MOVGTS pc,r14 ; Ensure system area is being used.
CMP r0,#10 ; If *sload is used then change
MOVEQ r0,#11 ; it into a *smerge
CMP r0,#9 ; If *snew is run then use
BEQ MySnew ; the 'safe' version.
MOVS pc,r14 ; Otherwise, carry on...
MySnew
STMFD r13!,{r0-r12}
MOV r0,#8
MOV r1,#0
SWI OS_SpriteOp ; Get number of sprites in area
MOV r6,r3
MOV r0,#13
ADR r2,buff
MOV r4,#1
SearchForNames
MOV r0,#13
MOV r3,#&ff
SWI OS_SpriteOp ; Get sprite name
ADR r0,str1
BL CheckNames ; Check if OK to delete
MOV r7,r5
ADR r0,str2 ; and again...
BL CheckNames
ADD r5,r7,r5
CMP r5,#1
ADDEQ r4,r4,#1 ; MOVe to next sprite
BEQ NoDelete
MOV r0,#25
SWI OS_SpriteOp ; Delete the sprite.
NoDelete
SUBS r6,r6,#1
BNE SearchForNames
LDMFD r13!,{r0-r12,r15}
CheckNames
STMFD r13!,{r0-r4,r14}
ADR r1,buff
MOV r5,#1 ; Assume they are the same
CheckLoop
LDRB r2,[r0],#1
LDRB r3,[r1],#1
CMP r2,#0
BEQ ExitLoop
CMP r3,#0 ; Check if at the end.
MOVEQ r5,#0 ; Set to "not same"
BEQ ExitLoop ; if so, exit
CMP r2,r3 ; Check if letters are the same
BEQ CheckLoop
MOV r5,#0
ExitLoop
LDMFD r13!,{r0-r4,r15}
str1 = "sparkfs", 0
str2 = "mfs", 0
buff DCD 0
DCD 0
DCD 0
DCD 0
END